home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 5 / Amiga Plus Sonderheft 1996 #5.iso / programme / visual / rexx / imagefx1.03.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-15  |  2KB  |  115 lines

  1. /*
  2.  * $VER: 1.01 (2-mar-1995)
  3.  *
  4.  * Arexx program for Visual to generate thumbnails with ImageFX 1.03.
  5.  * Written by C.Vallee
  6.  *
  7.  * This script generates thumbnails for all the selected file
  8.  * Version for ImageFX 1.03.
  9.  *
  10.  */
  11.  
  12. options results
  13. gfxport = IMAGEFX.1
  14.  
  15. /* Loading ImageFX, if not present */
  16.  
  17. if (~show('p',gfxport)) then do
  18.    message "Loading ImageFX..."
  19.    address command "run ImageFX:ImageFX Iconify WB"
  20.    message "Waiting for the "||gfxport||" ARexx port..."
  21.  
  22. /* Waiting for the ARexx port every 2 seconds until present */
  23.    do while (~show('p',gfxport))
  24.       address command "Wait 2"
  25.       check
  26.       if rc ~= 0 then exit
  27.    end
  28. end
  29.  
  30. GetInfo
  31. parse var result '"' mypalette '"' w h .
  32.  
  33. address value gfxport
  34.  
  35. Redraw Off
  36. Undo Off
  37.  
  38. /* The next line seems to be necessary to set the HAM8 mode */
  39. Render Mode Hires Lace
  40. Render colors 64
  41. Render Mode Hires Lace Ham
  42.  
  43. LockRange 0 Off
  44. Palette Rend
  45. LoadPalette '"'mypalette'"' '-1'
  46. LockRange 0 On
  47.  
  48. address
  49.  
  50. do forever
  51.    check
  52.    if rc ~= 0 then break
  53.  
  54.    getselected
  55.    if result = "" then break
  56.    file = result
  57.  
  58.    i = LASTPOS('/', file)
  59.    if i = 0 then i = lastpos(':', file)
  60.    name = substr( file , i+1 )
  61.  
  62.    message 'Loading "'||name||'"...' 
  63.  
  64.    address
  65.    LoadBuffer '"'file'"' Force NoSmooth
  66.  
  67.    if rc = 0 then do
  68.       GetMain
  69.       parse var result '"' . '"' width height d .
  70.  
  71.       if ( width * h ) > (height * w ) then do
  72.          height = ( height * w ) % width
  73.          width = w
  74.       end
  75.       else do
  76.          width = ( width * h ) % height
  77.          height = h
  78.       end
  79.  
  80.       address VISUAL message 'Scaling "'||name||'"...'
  81.       Scale width height
  82.  
  83.       if d == 1 then do
  84.          address VISUAL message 'Grey2Color "'||name||'"...'
  85.          Grey2Color
  86.       end
  87.  
  88.       address VISUAL message 'Rendering "'||name||'"...'
  89.       Render Go
  90.  
  91.       SaveRenderedAs ILBM '"'file'.icn"'
  92.  
  93.       Render Close
  94.     
  95.       KillBuffer Force
  96.  
  97.       address
  98.       update
  99.       end
  100.    else do
  101.       address
  102.       unselect
  103.    end
  104. end
  105.  
  106. address
  107.  
  108. Undo On
  109. Redraw On
  110.  
  111.  
  112. /* Quit ImageFX */
  113.  
  114. Quit force
  115.